package com.mccrea.pattern.iterator;

import java.util.Iterator;

/**
 * @Classname Client
 * @Description 迭代器测试类
 * @Date 2021/5/20 0020 17:33
 * @Created by Mccrea_Gao
 */
public class Client {
    public static void main(String[] args) {
        BookShelf bookShelf = new BookShelf();
        bookShelf.addBook(new Book("西游记"));
        bookShelf.addBook(new Book("水浒传"));
        bookShelf.addBook(new Book("红楼梦"));
        bookShelf.addBook(new Book("三国演义"));
        Iterator<Book> iterator = bookShelf.iterator();
        while (iterator.hasNext()) {
            Book book = iterator.next();
            System.out.println(book.getName());
        }
    }
}
